#include <myheader_c_plus.h>
using std::endl;
using std::cout;
using std::string;
using std::deque;
using std::cin;
int main(int argc, char *argv[])
{
    string str;
    deque<string> qu;
    while(cin >> str){
        qu.push_back(str);
        for(auto it = qu.begin(); it != qu.end(); ++it){
            cout << *it << " ";
        }
        cout << endl;
    }
    return 0;
}

